interface KHTMLElement {
    /**
     * 获取属性
     * @param key 属性键
     * @returns 属性值
     */
    getAttr(key: Tdom_attr_keys): string | null;
}
{
    Object.defineProperty(KHTMLElement.prototype, 'getAttr', {
        writable: false,
        configurable: false,
        enumerable: false,
        value: function (this: KHTMLElement, key: Tdom_attr_keys) {
            const ele = this.ele();
            if (!ele) { return null; }

            if (U.O.hasKey(Edom_attr_assign, key)) {
                return (ele as any)[key as Tdom_attr_key_assign];
            }

            if (U.O.hasKey(Edom_attr_class, key)) {
                return Array.from(ele.classList).join(' ');
            }

            if (U.O.hasKey(Edom_attr_classlist, key)) {
                return Array.from(ele.classList).join(',');
            }

            return ele.getAttribute(key);
        }
    });
}
